<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!--360浏览器优先以webkit内核解析-->
    <title>成都市12345话务接电系统</title>
    <link rel="shortcut icon" th:href="@{favicon.ico}">
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/style.css}" rel="stylesheet"/>
    <style>
        .ibox-content a{
            color: inherit;
        }
        .ibox-content span{
            color: red;
        }
        table thead,
        tbody tr {
            display: table;
            width: 100%;
            table-layout: fixed;
        }

        table thead {
            width: calc( 100% - 1em)
        }
        td{
            overflow: hidden;text-overflow: ellipsis;white-space: nowrap;
        }
    </style>
</head>

<body class="gray-bg">
<div class="home" style="padding: 10px;">
    <!--    快捷系统功能    -->
    <div class="col-sm-12 home-fast" th:if="${shortcutFuns.size()>0}" style="border-radius: 10px">
        <div class="home-fast-top" >
            <div>快捷系统功能</div>
            <div><i class="fa fa-refresh"></i>刷新首页</div>
        </div>
        <div class="home-fast-centre">

            <div class="home-fast-centre-box" th:each="shortcutFun : ${shortcutFuns}" th:id="${shortcutFun.url}" th:title="${shortcutFun.name}" onclick="openUrl(this.title,this.id)">
                <img  th:src="${shortcutFun.imgUrl}">
                <div><a href="javascript:void(0)">[[${shortcutFun.name}]]</a></div>
            </div>

        </div>
    </div>
    <div class="col-sm-12" style="display:flex;">
        <!--左-->
        <div class="col-sm-6 entering-page">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#loginState" aria-expanded="true" onclick="hiddenSub()">登录情况</a></li>
                        <li class=""><a data-toggle="tab" href="#flatDept" aria-expanded="false" onclick="loadFlatDept()">本级部门</a></li>
                        <li class=""><a data-toggle="tab" href="#subDept" aria-expanded="false" onclick="loadSub()">下级部门</a></li>
                    </ul>
                    <div class="tab-content">
                        <div id="loginState" class="tab-pane active">
                            <div class="panel-body">
                                <div class="ibox" style="margin-bottom: 0">
                                    <div class="ibox-title col-sm-12" >
                                            <h3 >全区部门登录情况</h3>
<!--                                        <div style="font-size: 13px;text-align: right">在线总人数 ：<span class="text-navy">0</span>/0</div>-->
                                        <div style="font-size: 13px;text-align: right">
                                            在线总人数 ：<span class="text-navy" th:text="${@commonServiceImpl.areaAllCount('__${deptId}__')}">0</span>/<span th:text="${@commonServiceImpl.areaOnlineCount('__${deptId}__')}">0</span>
                                        </div>
                                    </div>
                                    <div class="ibox-content table-responsive">
                                        <table class="table text-nowrap table-hover no-margins">
                                            <thead>
                                            <tr>
                                                <th>下级部门</th>
                                                <th>在线人数/总人数</th>
                                                <th style="text-align: center">最近操作</th>
                                                <th>受理情况</th>
                                            </tr>
                                            </thead>
                                            <tbody style="display:block;height: 380px;overflow-y:scroll;">
                                            <tr th:each="loginState:${@commonServiceImpl.loginState('__${deptId}__')}">
                                                <td><small>[[${loginState['deptName']}]]</small></td>
                                                <td style="text-align: center"><span class="text-danger">[[${loginState['onlineCount']}]]</span>/[[${loginState['allCount']}]]</td>
                                                <td style="text-align: center">[[${loginState['recentTime']}]]</td>
                                                <td class="text-navy"> [[${loginState['orderCount']}]]</td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div id="flatDept" class="tab-pane">
                            <div class="panel-body">
                                <div class="col-sm-12">
                                    <div class="tabs-container">
                                            <ul class="nav nav-tabs">
                                                <li class="active"><a data-toggle="tab" href="#flatTel" aria-expanded="true" onclick="loadFlatTel()">电话</a></li>
                                                <li class=""><a data-toggle="tab" href="#flatMail" onclick="loadFlatMail()" aria-expanded="false">信件</a></li>
                                            </ul>
                                            <div class="tab-content ">
                                                <div id="flatTel" class="tab-pane active" >
                                                    <div class="panel-body">
                                                        <div class="ibox">
                                                            <div class="ibox-title"><h3 id="ppT">[[${menuName}]]</h3></div>
                                                            <div class="ibox-content">
                                                                <p id="ppTel"></p>
<!--                                                                <p th:each="item:${flatTel}"><a th:onclick="rptOpenMenuInParent(${item['menuNo']})" th:utext="${item['clewDesc']}"></a></p>-->
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div id="flatMail" class="tab-pane" >
                                                    <div class="panel-body">
                                                        <div class="ibox">
                                                            <div class="ibox-title"><h3 id="ppM">[[${menuName}]]</h3></div>
                                                            <div class="ibox-content">
                                                                <p id="ppMail"></p>
<!--                                                                <p th:each="item:${flatMail}"><a th:onclick="rptOpenMenuInParent(${item['menuNo']})" th:utext="${item['clewDesc']}"></a></p>-->
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                            </div>

                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- start -->
                        <!-- 下级部门 -->
                        <div id="subDept">
                            <div class="panel-body">
                                <div class="col-sm-12">
                                    <div class="tabs-container" id="isHidden">
                                        <ul class="nav nav-tabs">
                                            <li class="active"><a data-toggle="tab" href="#subTel" aria-expanded="true" >电话</a></li>
                                            <li class=""><a data-toggle="tab" href="#subMail" onclick="loadSubMail()" aria-expanded="false">信件</a></li>
                                        </ul>
                                        <div class="tab-content ">
                                            <div id="subTel" class="tab-pane active">
                                                <div class="panel-body">
                                                    <div class="ibox">
                                                        <table class="table text-nowrap table-hover no-margins">
                                                            <thead>
                                                            <tr>
                                                                <th style="width: 143.13px;text-align: center">部门</th>
                                                                <th style="width: 60px;text-align: center">未签收</th>
                                                                <th style="width: 60px;text-align: center">未回复</th>
                                                                <th style="width: 60px;text-align: center">退回</th>
                                                                <th style="width: 60px;text-align: center">超期</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody id="tableBodyTel" style="display:block;height: 380px;overflow-y:scroll;">
                                                            </tbody>
                                                        </table>

                                                    </div>
                                                </div>
                                            </div>
                                            <div id="subMail" class="tab-pane">
                                                <div class="panel-body">
                                                    <div class="ibox">

                                                        <table class="table text-nowrap table-hover no-margins">
                                                            <thead>
                                                            <tr>
                                                                <th style="width: 143.13px;text-align: center;">部门</th>
                                                                <th style="width: 60px;text-align: center;">未签收</th>
                                                                <th style="width: 60px;text-align: center;">未回复</th>
                                                                <th style="width: 60px;text-align: center;">退回</th>
                                                                <th style="width: 60px;text-align: center;">超期</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody id="tableBody" style="display:block;height: 380px;overflow-y:scroll;">
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- end -->
                    </div>
                </div>
            </div>
        </div>
        <!--右-->
        <div class="col-sm-6 entering-page">
            <div class="col-sm-12" style="display:flex;">
                <!--重要待办事项提示-->
                <div class="col-sm-6 home-fast" style="border-radius: 10px;margin-top: 10px;">
                    <div class="home-centre-name">
                        <div>重要待办事项提示</div>

                    </div>
                    <div class="col-sm-12 home-hint" style="z-index: 20;overflow-y:scroll">
<!--                        <div>-->
<!--                            - 暂无新的待办 - -->
<!--                        </div>-->
                        <div th:each="item:${wait}" style="margin-bottom: 5px">
                            <span style="cursor:pointer;" th:onclick="OpenMenuInParent([[${item['menuNo']}]])" th:utext="${item['clewDesc']}"></span>
                        </div>
                    </div>
                    <div class="home-hint-img">
                        <img th:src="@{/img/Inbox.png}" class="img img-object" style="width: 180px;height: 180px;z-index: 10;">
                    </div>
                </div>
                <!--上级催办键-->
                <div class="col-sm-6 home-fast" style="border-radius: 10px;margin-top: 10px;margin-left: 10px;">
                    <div class="home-centre-name">
                        <div>上级催办键</div>
                    </div>
                    <div class="col-sm-12 home-hint" style="z-index: 20;overflow-y:scroll">
                        <!--                <div>-->
                        <!--                    - 暂无新的待办 - -->
                        <!--                </div>-->
                        <div style="margin-bottom: 5px">
                            <span style="cursor:pointer;" th:onclick="openUrgeDetail('tel')">电话催办工单：<span class="spLRed">[[${urge.tel}]]</span> 件</span>
                        </div>
                        <div>
                            <span style="cursor:pointer;" th:onclick="openUrgeDetail('mail')">信件催办工单：<span class="spLRed">[[${urge.mail}]]</span> 件</span>
                        </div>
                    </div>
                    <div class="home-hint-img">
                        <img th:src="@{/img/Inbox.png}" class="img img-object" style="width: 180px;height: 180px">
                    </div>
                </div>
            </div>
            <div class="col-sm-12" style="">
                <div class="home-centre-name col-sm-8">
                    系统通知公告
                </div>
                <div class="col-sm-3 col-sm-offset-1">
                    <div class="input-group" style="margin-left: -128px">
                        <input type="text" class="form-control" title="请输入标题/内容/发布者名称/部门名称" placeholder="请输入标题/内容/发布者名称/部门名称" id="ntcTitle"
                               style="border-radius: 5px 0 0 5px;height: 30px;margin-top: 0px;"/>
                        <span th:id="${num}" class="input-group-addon" onclick="safSearch(20,this.id)"><i class="glyphicon glyphicon-search"></i></span>
                    </div>
                </div>
                <div class="col-sm-12" style="">
                    <div class="tabs-container">
                        <ul class="nav nav-tabs">
                            <li class="active"><a data-toggle="tab" href="#unRead" aria-expanded="true">未读</a></li>
                            <li class=""><a data-toggle="tab" href="#markRead" aria-expanded="false">已读</a></li>
                        </ul>
                        <div class="tab-content">
                            <!--未读-->
                            <div id="unRead" class="tab-pane active">
                                <div class="panel-body" style="height: 305px;">
                                    <div class="ibox" style="margin-bottom: 0;">
                                        <div  class="col-sm-12" style="border-radius: 10px;height: 265px;overflow-y:scroll;background-color: #FFFFFF;padding: 0 0 20px;">
                                            <div th:fragment="search" id="search" style="height: 100%">
                                                <div class="home-buttom-announcement col-sm-12"  style="line-height: 32px;"  th:each="u : ${notice.rows}">
                                                    <div style="margin-left: -9px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor: pointer;" class="col-sm-5">
                                                        <a th:title="${u.ntcTitle}" th:classappend="${u.sortCode == '21' && u.nlogid==0?'urgent':(u.sortCode == '12' && u.nlogid==0?'major':(u.sortCode == '11' && u.nlogid==0?'common':'read'))}" onclick="QxWinShowNtc(event,this.id)" th:id="${u.afficheId}">[[${u.ntcTitle}]]</a>
                                                    </div>
                                                    <div class="col-sm-5" style="color: #B0B3B6">发布者：[[${u.issueUser}]]</div>
                                                    <div class="col-sm-2" style="color: #B0B3B6;text-align: center;width: 85px; overflow: hidden; text-overflow:clip; white-space: nowrap;cursor: pointer;" th:title="${#dates.format(u.issueTime,'yyyy-MM-dd HH:mm:ss')}">[[${#dates.format(u.issueTime,'yyyy-MM-dd HH:mm:ss')}]]</div>
                                                </div>
                                                <div  th:if="${#lists.size(notice.rows) eq 0 && total != num} " class="col-sm-12 home-hint">
                                                    <div>
                                                        - 暂无新的通知 -
                                                    </div>
                                                </div>
                                                <input type="hidden" id="total" th:value="${total}">
                                                <div class="col-sm-12" th:unless="${#lists.size(notice.rows) eq 0}" onclick="more(10,this.id)" th:id="${num}"  style="text-align: center"><a id="more" th:text="${total == num ?'到底了':'加载更多'}"></a></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--已读-->
                            <div id="markRead" class="tab-pane">
                                <div class="panel-body" style="height: 305px">
                                    <div class="ibox" style="margin-bottom: 0;">
                                        <div  class="col-sm-12" style="border-radius: 10px;height: 265px;overflow-y:scroll;background-color: #FFFFFF;padding: 0 0 20px;">
                                            <div th:fragment="markRead" id="noRead" style="height: 100%" th:if="${read!=null}">
                                                <div class="home-buttom-announcement col-sm-12"  style="line-height: 32px;"  th:each="u : ${read.rows}">
                                                    <div style="margin-left: -9px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor: pointer;" class="col-sm-5">
                                                        <a th:title="${u.ntcTitle}" th:classappend="${u.sortCode == '21' && u.nlogid==0?'urgent':(u.sortCode == '12' && u.nlogid==0?'major':(u.sortCode == '11' && u.nlogid==0?'common':'read'))}" onclick="QxWinShowNtc(event,this.id)" th:id="${u.afficheId}">[[${u.ntcTitle}]]</a>
                                                    </div>
                                                    <div class="col-sm-5" style="color: #B0B3B6">发布者：[[${u.issueUser}]]</div>
                                                    <div class="col-sm-2" style="color: #B0B3B6;text-align: center;width: 85px; overflow: hidden; text-overflow:clip; white-space: nowrap;cursor: pointer;" th:title="${#dates.format(u.issueTime,'yyyy-MM-dd HH:mm:ss')}">[[${#dates.format(u.issueTime,'yyyy-MM-dd HH:mm:ss')}]]</div>
                                                </div>
                                                <div  th:if="${#lists.size(notice.rows) eq 0 && total != num} " class="col-sm-12 home-hint">
                                                    <div>
                                                        - 暂无新的通知 -
                                                    </div>
                                                </div>
                                                <input type="hidden" id="total" th:value="${total}">
                                                <div class="col-sm-12" th:unless="${#lists.size(notice.rows) eq 0}" onclick="more(10,this.id)" th:id="${num}"  style="text-align: center"><a id="more" th:text="${total == num ?'到底了':'加载更多'}"></a></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>
    <script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
    <script th:src="@{/ajax/libs/layui/laydate.js}"></script>

</div>
<th:block th:include="include :: footer" />
</body>
<script>
    lay('#version').html('-v'+ laydate.v);

    $(function () {
        setInterval(function() {
            if($('#flatTel').hasClass('active')){
                loadFlatTel();
            }
            if($('#flatMail').hasClass('active')){
                loadFlatMail();
            }
            if($('#deptTel').hasClass('active')){
                loadFlatTel();
            }
            if($('#deptMail').hasClass('active')){
                loadFlatMail();
            }
        },300000)//每五分钟重新加载一遍处理情况
    })

    function rptOpenMenuInParent(muID) {
        if (!muID) {
            return
        }
        var toFg = parseInt(muID);
        var ttl="";
        var url="";
        var reportTel = "/system/report/tel"
        var reportMail = "/system/report/mail"
        switch(toFg) {
            case 3142:
                ttl = "被市级拒退工单T";
                url = reportTel + "/notPass";
                break;
            case 3143:
                ttl = "未转派工单T";
                url =  reportTel + "/sendWait";
                break;
            case 3153:
                ttl = "下级退回T";
                url = telWF + "/rCity/listSonBack";
                break;
            case 3123:
                ttl = "承办单位未签收T";
                url = reportTel + "/listSonSignNot";
                break;
            case 3169:
                ttl = "承办单位已退T";
                url = reportTel + "/listSonAgreeBack";
                break;
            case 3102:
                ttl = "超期工单T";
                url = reportTel + "/muRedS";
                break;
            case 3101:
                ttl = "临期工单T";
                url = reportTel + "/muBlueS";
                break;
            case 3159:
                ttl = "办理量T";
                url = reportTel + "/reportOver";
                break;
            case 3163:
                ttl = "未签收工单T";
                url = reportTel + "/muSignNot";
                break;
            case 3165:
                ttl = "已退工单T";
                url = reportTel + "/muDeptBack";
                break;
            case 3359:
                ttl = "办理量M";
                url = reportMail+"/reportOver";
                break;
            case 3343:
                ttl = "未转派工单M";
                url = reportMail+"/sendWait";
                break;
            case 3342:
                ttl = "市级拒退工单M";
                url = reportMail+"/notPass";
                break;
            case 3369:
                ttl = "承办单位已退工单M";
                url = reportMail+"/listSonAgreeBack";
                break;
            case 3323:
                ttl = "承办单位未签收工单M";
                url = reportMail+"/listSonSignNot";
                break;
            case 3363:
                ttl = "未签收工单M";
                url = reportMail + "/muSignNot";
                break;
            case 3365:
                ttl = "已退工单";
                url = reportMail + "/muDeptBack";
                break;
            case 3302:
                ttl = "超期工单M";
                url = reportMail+"/muRedS";
                break;
            case 3301:
                ttl = "临期工单M";
                url = reportMail+"/muBlueS";
                break;
            default:
                break;
        }
        $.modal.openDialog(ttl,url,'80%','83%');
    }

    function OpenMenuInParent(muID) {
        var toFg = parseInt(muID);
        var ttl="";
        var url="";
        var mTelWF = "/system/mTelWF";
        var mMailWF = "/system/mMailWF";
        switch(toFg){
            case 3140:
                ttl="市级未签收T";
                url= mTelWF + "/cmnFile/muSignNot";
                break;
            case 3156:
                ttl="待本部门回复T";
                url= mTelWF + "/cmnFile/muReplyWait";
                break;
            case 3163:
                ttl="未签收t（区县）";
                url= mTelWF + "/cmnFile/muSignNot";
                break;
            case 3169:
                ttl="待本级回复t";
                url= mTelWF + "/cmnFile/muReplyWait";
                break;

            case 3340:
                ttl="市级未签收M";
                url= mMailWF + "/cmnFile/signNotList";
                break;
            case 3356:
                ttl="待本部门回复M";
                url= mMailWF + "/cmnFile/replyWait";
                break;
            case 3363:
                ttl="未签收m（区县）";
                url= mMailWF + "/cmnFile/signNotList";
                break;
            case 3369:
                ttl="待本级回复m";
                url= mMailWF + "/cmnFile/replyWait";
                break;

            case 3157:
                ttl="上级不同意退回工单T";
                url=mTelWF+"/cmnFile/NotPass";
                break;
            case 3357:
                ttl="上级不同意退回工单M";
                url=mMailWF+"/cmnFile/rNotPassList";
                break;
            case 3158:
                ttl="未受理电话工单";
                url=mTelWF+"/cmnFile/notHandleTelList";
                break;
            case 3358:
                ttl="未受理信件工单";
                url=mMailWF+"/cmnFile/notHandleMailList";
                break;

            // case 3640:
            //     ttl="市级未签收P";
            //     url="../mMsgWF/cmnFile/muSignNot";
            //     break;
            // case 3656:
            //     ttl="待本部门回复P";
            //     url="../mMsgWF/cmnFile/muReplyWait";
            //     break;
            // case 3663:
            //     ttl="未签收p（区县）";
            //     url="../mMsgWF/cmnFile/muSignNot";
            //     break;
            // case 3669:
            //     ttl="待本级回复p";
            //     url="../mMsgWF/cmnFile/muReplyWait";
            //     break;

            default:
                break;
        }
        $.modal.openTab(ttl,url);
    }

    //加载本级部门电话工单处理信息
    function loadFlatTel(){
        document.getElementById("isHidden").hidden=true;
        var config = {
            url:'/system/flatTelJson',
            success:function (res) {
                $('#ppT').text(res[0]['menuName']);
                $("#ppTel").empty("");
                //var str = "";
                for (var i = 0; i < res.length; i++) {
                    var str="<div><a onclick="+'"rptOpenMenuInParent('+res[i].menuNo+')">'+res[i].clewDesc+'</a></div>';
                    $("#ppTel").append(str);
                }
            }
        }
        $.ajax(config);
    }

    //加载本级部门信件工单处理信息
    function loadFlatMail(){
        document.getElementById("isHidden").hidden=true;
        var config = {
            url:'/system/flatMailJson',
            success:function (res) {
                $('#ppM').text(res[0]['menuName']);
                $("#ppMail").empty("");
                //var str = "";
                for (var i = 0; i < res.length; i++) {
                    var str="<div><a onclick="+'"rptOpenMenuInParent('+res[i].menuNo+')">'+res[i].clewDesc+'</a></div>';
                    $("#ppMail").append(str);
                }
            }
            // success:function (res) {
            //     $('#flatDept>.ibox-title h3').text(res[0]['menuName']);
            //     $.each($('#flatMail .ibox-content p a'),function(index,value){
            //         $(value).html(res[index]['clewDesc']);
            //     })
            // }
        }
        $.ajax(config);
    }

    //信件
    function loadSubMail(){
        $.ajax({
            url: "/system/report/mail/listSubStatisticsJson",
            data: {},
            method: 'POST',
            dataType:'json',
            success: function (data) {
                $("#tableBody").empty("");
                var str = "";
                //定义用于拼接的字符串
                for (var i = 0; i < data.length; i++) {
                    //paymentmoney[i] = data[i].paymoney_Type;
                    //拼接表格的行和列
                    str = "<tr style='text-align: center;'>" +
                        "<td><div style='width: 143.13px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor:pointer;' title="+ data[i].deptName +">" + data[i].deptName + "</div></td>" +
                        "<td style='width: 60px;cursor:pointer;' onclick='subDeptMailDetail("+ data[i].deptId+")' title='点击查看该部门未签收详情'>" + data[i].subNotSignNum + "</td>" +
                        "<td style='width: 60px;'>" + data[i].subNotReplyNum + "</td>" +
                        "<td style='width: 60px;'>" + data[i].subBackNum + "</td>" +
                        "<td style='width: 60px;'>" + data[i].subBlueNum + "</td></tr>";
                    //追加到table中
                    $("#tableBody").append(str);
                }
            }
        });
    }

    // 页面加载后立即执行
    $(document).ready(function () {
        document.getElementById("isHidden").hidden=true;
    });

    //下级部门
    function loadSub(){
        loadSubTel();//默认先加载电话报表数据
        document.getElementById("isHidden").removeAttribute("hidden");
    }

    function hiddenSub(){
        document.getElementById("isHidden").hidden=true;
    }

    //加载本级部门数据
    function loadFlatDept(){
        hiddenSub();
        loadFlatTel();
    }
    //电话
    function loadSubTel(){
        $.ajax({
            url: "/system/report/tel/listTelSubStatisticsJson",
            data: {},
            method: 'POST',
            dataType:'json',
            success: function (result) {
                $("#tableBodyTel").empty("");
                var str = "";
                //定义用于拼接的字符串
                for (var i = 0; i < result.length; i++) {
                    // debugger
                    //拼接表格的行和列
                    str = "<tr style='text-align:center'>" +
                        "<td><div style='width: 143.13px;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;cursor:pointer;' title="+result[i].deptName+">" + result[i].deptName + "</div></td>" +
                        "<td style='width: 60px;cursor:pointer;' onclick='subDeptTelDetail("+ result[i].deptId +")' title='点击查看该部门未签收详情'>" + result[i].subNotSignTelNum + "</td>" +
                        "<td style='width: 60px'>" + result[i].subNotReplyTelNum+ "</td>" +
                        "<td style='width: 60px'>"+result[i].subBackTelNum + "</td>" +
                        "<td style='width: 60px'>"+result[i].subBlueTelNum+ "</td></tr>";
                    //追加到table中
                    $("#tableBodyTel").append(str);
                }
            }

        });
    }

    //执行一个laydate实例
    laydate.render({
        elem: '#test1', //指定元素
        position: 'static',
        showBottom: false
    });

    //查看公告详情
    function QxWinShowNtc(e,val) {
        $(e.target).css('color','gray');
        // alert(val)
        $.post("/notice/log",{afficheId:val},function(result){
            console.log(result)
        });
        // window.location="/notice/log?afficheId="+val;
        var url = '/system/user/saf?id='+val;
        var options = {
            title: "通知详情",
            width: '1280px',
            height: '650px',
            left:'80px',
            url: url,
            skin: 'layui-layer-gray',
            btn: ['关闭'],
            yes: function (index, layero) {
                $.modal.close(index);
            }
        };
        $.modal.openOptions(options);
        // $.operate.detail(val,'850px','650px');
    }

    //通知公告查询
    function safSearch(size,curPage){
        $.modal.loading("数据加载中，请稍后...");
        //搜索内容
        let searchTitle = $('#ntcTitle').val();
        debugger
        $.ajax({
            url: "/system/notice/search",
            data: {
                content:searchTitle,
                pageNum: curPage,
                pageSize: size
            },
            type: 'POST',
            success: function (data) {
                console.log(data);
                $.modal.closeLoading();
                $("#search").html(data)
                var scrollHeight = $('#notice').prop("scrollHeight");
                $('#notice').scrollTop(scrollHeight,200);
            }
        })
    }

    //通知公告查询：加载更多
    function more(size,curPage){
        var total = parseInt($("#total").val());
        var pageNum = parseInt(curPage);
        if(pageNum>=total){
            return;
        }
        $.modal.loading("数据加载中，请稍后...");
        //搜索内容
        //加载更多
        let searchTitle = $('#ntcTitle').val();
        $.ajax({
            url: "/system/notice/search",
            data: {
                content:searchTitle,
                pageNum: pageNum+1,
                pageSize: size
            },
            type: 'POST',
            success: function (data) {
                console.log(data);
                document.getElementById('more').remove();
                $.modal.closeLoading();
                $("#search").append(data)
                var scrollHeight = $('#notice').prop("scrollHeight");
                $('#notice').scrollTop(scrollHeight,200);
            }
        })
    }

    //回车快捷键
    window.onkeyup=function (){
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==13){ // 按 Enter
            safSearch(10,1);
        }
    }

    function menuItem() {
        // 获取标识数据
        var dataUrl = $(this).attr('href'),
            dataIndex = $(this).data('index'),
            menuName = $.trim($(this).text()),
            isRefresh = $(this).data("refresh"),
            flag = true;
        if(dataUrl == '#') return;

        var $dataObj = $('a[href$="' + decodeURI(dataUrl) + '"]');
        if (!$dataObj.hasClass("noactive")) {
            $('.tab-pane li').removeClass("active");
            $('.nav ul').removeClass("in");
            $dataObj.parents("ul").addClass("in")
            $dataObj.parents("li").addClass("active").siblings().removeClass("active").find('li').removeClass("active");
            $dataObj.parents("ul").css('height', 'auto').height();
            $(".nav ul li, .nav li").removeClass("selected");
            $(this).parent("li").addClass("selected");
        }
        setIframeUrl(dataUrl);
        if (dataUrl == undefined || $.trim(dataUrl).length == 0) return false;

        // 选项卡菜单已存在
        $('.menuTab').each(function() {
            if ($(this).data('id') == dataUrl) {
                if (!$(this).hasClass('active')) {
                    $(this).addClass('active').siblings('.menuTab').removeClass('active');
                    scrollToTab(this);
                    // 显示tab对应的内容区
                    $('.mainContent .NAP_iframe').each(function() {
                        if ($(this).data('id') == dataUrl) {
                            $(this).show().siblings('.NAP_iframe').hide();
                            return false;
                        }
                    });
                }
                if (isRefresh) {
                    refreshTab();
                }
                flag = false;
                return false;
            }
        });
        // 选项卡菜单不存在
        if (flag) {
            var str = '<a href="javascript:;" class="active menuTab" data-id="' + dataUrl + '">' + menuName + ' <i class="fa fa-times-circle"></i>';
            $('.menuTab').removeClass('active');

            // 添加选项卡对应的iframe
            var str1 = '<iframe class="NAP_iframe" name="iframe' + dataIndex + '" width="100%" height="100%" src="' + dataUrl + '" frameborder="0" data-id="' + dataUrl + '" seamless></iframe>';
            $('.mainContent').find('iframe.NAP_iframe').hide().parents('.mainContent').append(str1);

            $.modal.loading("数据加载中，请稍后...");

            $('.mainContent iframe:visible').load(function () {
                $.modal.closeLoading();
            });

            // 添加选项卡
            $('.menuTabs .page-tabs-content').append(str);
            scrollToTab($('.menuTab.active'));
        }
        return false;
    }

    function openUrl(val,url){
        $.modal.openTab(val,url)
    }

    $('.menuItem').on('click', menuItem);

    // 催办详情页面
    function openUrgeDetail(type) {
        var ttl = '';
        var url = '';
        var mTelWF = "/system/mTelWF";
        var mMailWF = "/system/mMailWF";
        if(type === 'tel'){
            ttl="电话催办工单";
            url= mTelWF + "/cmnFile/supUrgeTelOrder";
        }else if(type === 'mail'){
            ttl="信件催办工单";
            url= mMailWF + "/cmnFile/supUrgeMailOrder";
        }
        $.modal.openTab(ttl,url);
    }

    //电话未签收详情
    function subDeptTelDetail(deptId){
        let ttl = '下级未签收工单T'
        let url = ctx + 'system/report/tel/subDeptTelDetail/' + deptId
        $.modal.openDialog(ttl,url,'80%','83%')
    }

    //信件未签收详情
    function subDeptMailDetail(deptId){
        let ttl = '下级未签收工单M'
        let url = ctx + 'system/report/mail/subDeptMailDetail/' + deptId
        $.modal.openDialog(ttl,url,'80%','83%')
    }
</script>
</html>
